#use Test::More tests => 3;
use Test::More qw(no_plan);

BEGIN {
use_ok( 'Firepear::Carrot::Grammarian' );
}


################################################################## CONSTRUCTOR

#------------------------------------------------------------- 901 no filelist
my $g = Firepear::Carrot::Grammarian->new();
is ($g->status, 901, 'no filelist');

$g = Firepear::Carrot::Grammarian->new( filelist => ['t/corpus/grammar.1'] );
is ($g->status, 0, 'successful instantiation');
is ($g->{output}, './f_c_g', 'no prefix and no explicit output name');

$g = Firepear::Carrot::Grammarian->new( filelist => ['t/corpus/grammar.0'],
                                        prefix   => './t/corpus',
                                        output   => '05grammar');
is ($g->status, 0, 'successful instantiation');
is ($g->{output}, './t/corpus/05grammar', 'prefix and explicit output name');


############################################################### SIMPLE DOCUMENT


#------------------------------------------------------------ DOM instantiation
$g = Firepear::Carrot::Grammarian->new( filelist => ['t/corpus/grammar.1'],
                                        prefix   => './t/corpus',
                                        output   => '05grammar');
is ($g->status, 0, 'successful instantiation');
$g->parse;
is ($g->status, 0, 'success');
is ($g->{dom}->status, 0, 'DOM ready');
is_deeply ($g->{dom}->nodeattrs, {title => 'hello.carrot'}, 'attrs stowed');
#------------------------------------------------------------ continued parsing
$g->parse;
is ($g->status, 1, 'work complate');
is ($g->{dom}{dom}{text}[0], 'hello, world! ');


######################################################################## ERRORS

#------------------------------------------------------ 101 no document trigger
$g = Firepear::Carrot::Grammarian->new( filelist => ['t/corpus/grammar.0'],
                                        prefix   => './t/corpus',
                                        output   => '05grammar');
is ($g->status, 0, 'successful instantiation');
$g->parse;
is ($g->status, 101, '101 - no document trigger');

